<?php
namespace app\web\model;

use think\Model;

/**
 * @手册管理
 */
class ManualModel extends Model
{
    protected $name = 'manual';
    public function __construct($data = [])
    {
        parent::__construct($data);
    }
    public function ManualGroup()
    {
        return $this->hasOne('ManualGroupModel','id','group');
    }
    /**
     * @查询详情
     */
    public function selectById($where){
        $data = $this::where($where)->field('id,contents,title')->find();
        return $data;
    }
    
    /**
     * @模糊搜索列表
     */
    public function selectLikeList($where){
  
        $where[]=['ManualModel.status','eq',1];
        $data = $this::hasWhere('ManualGroup',$where)->with('ManualGroup')
                ->where($where)
                ->field('ManualModel.id,ManualModel.title')
                ->order('ManualGroupModel.sort desc,ManualModel.sort desc')
                ->select();
        return $data;
    }
}